package net.googlecode.kharchenko.services;

import net.googlecode.kharchenko.domains.Group;
import net.googlecode.kharchenko.domains.Person;

import java.util.List;

/**
 * Person Service. Get access to DAO classes.
 */
public interface PersonService {

    /**
     * Get person by e-mail.
     *
     * @param email person's e-mail
     * @return person.
     */
    public Person getPerson(String email);

    /**
     * Get groupmates of person.
     *
     * @param prs our person
     * @return list of groupmates.
     */
    public List getGroupMates(Person prs);

    /**
     * Get list of top5 persons by rate.
     *
     * @return list of top5 persons by rate.
     */
    public List getTop5();

    /**
     * Get list of all groups.
     *
     * @return list of all groups.
     */
    public List getAllGroups();


    /**
     * Save new person to database.
     *
     * @param prs person to be saved
     */
    public void savePerson(Person prs);

    /**
     * Get group by id.
     *
     * @param id group id
     * @return group.
     */
    public Group getGroup(Long id);

    /**
     * Get person by id.
     *
     * @param id person's id
     * @return person.
     */
    public Person getPersonById(Long id);

    /**
     * Is vote given for person from another person.
     *
     * @param id  Id of person to be check
     * @param prs person whose vote we check
     * @return Is vote given for person.
     */
    public boolean isVoteGiven(Long id, Person prs);

    /**
     * Take away vote for person.
     *
     * @param id  Id of person, which loses vote
     * @param prs person, who take away vote
     */
    public void takeAwayVote(Long id, Person prs);

    /**
     * Update information about Person.
     *
     * @param email person's e-mail
     * @param prs   new person information
     */
    public void updatePersonInfo(String email, Person prs);

    /**
     * Give vote for person.
     *
     * @param id  id of person, which get vote
     * @param prs person, who give vote
     */
    public void giveVote(Long id, Person prs);

    /**
     * Change password of user.
     *
     * @param email   E-mail of user
     * @param newPass new password of user
     */
    public void changePassword(String email, String newPass);
}
